﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/AdminMaster.Master" Inherits="System.Web.Mvc.ViewPage<VietThuongLMS.Areas.Admin.Models.GiaoVienModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript" src="<%: Url.Content("~/Scripts/MicrosoftAjax.js") %>"></script>
    <script type="text/javascript" src="<%: Url.Content("~/Scripts/MicrosoftMvcValidation.js") %>"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
    
    <legend>
        Thêm mới giáo viên
    </legend>
    <input hidden id="checkpoint" type="checkbox" disabled/>
    <% Html.EnableClientValidation();
       using (Html.BeginForm("Create", "GiaoVien", new { area = "Admin" }, FormMethod.Post, new { @class = "form-horizontal", @id = "formNew", @name = "formNew", enctype = "multipart/form-data" }))
       {
    %>
        <input type="hidden" id="hCheckedBook" name="hCheckedBook" />

        <%: Html.ValidationSummary(true) %>

        
          <div class="control-group">
                <label class="control-label" for="strFrom">
                    Tên Đăng Nhập: (*)</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.taiKhoan.UserName, new { @class = "h30", placeholder = "Tên Đăng Nhập...", onblur = "check_invalid();" })%>
                    <%: Html.ValidationMessageFor(m => m.taiKhoan.UserName)%>
                    <div style="color: Red; ">*Tên đăng nhập Tối thiểu 3 ký tự!</div>
                </div>
            </div>
            <%--<div class="control-group">
                <label class="control-label" for="strfrom">
                    Mật Khẩu :</label>
                <div class="controls">
                    <%: Html.PasswordFor(t => t.taiKhoan.Password, new { @class = "h30", placeholder = "Mật Khẩu..." })%>
                    <%: Html.ValidationMessageFor(m => m.taiKhoan.Password)%>
                    <div>*Mật khẩu Tối thiểu 6 ký tự!</div>
                </div>
            </div>--%>
            <div class="control-group">
                <label class="control-label" for="strFrom">
                    Tên Giáo viên: (*)</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.taiKhoan.FullName, new { @class = "h30", placeholder = "Tên Giáo Viên...", onblur = "check_invalid();" })%>
                    <%: Html.ValidationMessageFor(m => m.taiKhoan.FullName)%>
            
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="strFrom">
                    Địa chỉ :</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.taiKhoan.Address, new { @class = "h30", placeholder = "Địa Chỉ..." })%>
                    <%: Html.ValidationMessageFor(m => m.taiKhoan.Address)%>
            
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="strFrom">
                    Điện thoại : (*)</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.taiKhoan.Phone, new { @class = "h30", placeholder = "Điện Thoại..." })%>
                    <%: Html.ValidationMessageFor(m => m.taiKhoan.Phone)%>
            
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="strFrom">
                    Email : (*)</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.taiKhoan.Email, new { @class = "h30", placeholder = "Email..." })%>
                    <%: Html.ValidationMessageFor(m => m.taiKhoan.Email)%>
            
                </div>
            </div>
            <div class="control-group">
                <label class="control-label" for="strFrom">
                    Môn Học : (*)</label>
                <div class="controls">
                    <%= Html.DropDownList("ID", (SelectList)ViewData["LoaiMH"])%>    
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="strFrom">
                    Ngày Sinh :</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.taiKhoan.Birthday, new { @id = "txtDate", @class = "datePicker", placeholder = "Ngày Sinh..." })%>
                    <%: Html.ValidationMessageFor(m => m.taiKhoan.Birthday)%>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="strFrom">
                    Nghề Nghiệp :</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.taiKhoan.Job, new { @class = "h30", placeholder = "Nghề Nghiệp..." })%>
                    <%: Html.ValidationMessageFor(m => m.taiKhoan.Job)%>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="strFrom">
                    Nơi Làm Việc :</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.taiKhoan.Location_Work, new { @class = "h30", placeholder = "Nơi Làm Việc..." })%>
                    <%: Html.ValidationMessageFor(m => m.taiKhoan.Location_Work)%>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="AdminContent">
                    Giới Tính:</label>
                <div class="controls">
                    <%= Html.RadioButtonFor(t => t.taiKhoan.Sex, "Nam", new { Checked = "checked" })%> Nam
                    <%= Html.RadioButtonFor(t => t.taiKhoan.Sex, "Nữ")%> Nữ
                    <%= Html.ValidationMessageFor(t => t.taiKhoan.Sex)%>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="AdminContent">
                    Học Vấn:</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.HocVan, new { @class = "h30", placeholder = "Học Vấn..." })%>
                    <%: Html.ValidationMessageFor(m => m.HocVan)%>
                </div>
            </div>


            <div class="control-group">
                <label class="control-label" for="AdminContent">
                    Kinh Nghiệm Giảng Dạy:</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.KinhNghiemGiangDay, new { @class = "h30", placeholder = "Kinh nghiệm giảng dạy..." })%>
                    <%: Html.ValidationMessageFor(m => m.KinhNghiemGiangDay)%>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="AdminContent">
                    Kinh Nghiệm Biểu Diễn:</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.KinhNghiemBieuDien, new { @class = "h30", placeholder = "Kinh nghiệm biểu diễn..." })%>
                    <%: Html.ValidationMessageFor(m => m.KinhNghiemBieuDien)%>
                </div>
            </div>

            <div class="control-group">
                <label class="control-label" for="strFrom">
                    Ảnh đại diện:</label>
                <div class="controls">
                    <%: Html.TextBoxFor(t => t.Avatar, new { id = "Avatar", type = "file" })%>
                    <%: Html.ValidationMessageFor(m => m.Avatar)%>
                </div>
            </div>

            <div class="control-group">
                <div class="controls">
                    <button id="btnCreate" name="btnCreate" type="submit" class="btn btn-primary"><i class="icon-plus icon-white"></i>Tạo Giáo Viên</button>
                </div>
            </div>
        

    <% } %>

    <div class="btn btn-primary">
        <a href="<%=ResolveUrl("~/Admin/GiaoVien/Index") %>">
        <button class="btn btn-primary">
        <i class="icon-reply"></i>
            Quay lại danh sách
        </button></a>
    </div>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript">
//        $(document).ready(function () {
//            $(".datePicker").live('click', function () {
//                $(this).datepicker('destroy').datepicker({
//                    showOn: 'focus',
//                    dateFormat: 'dd MM yy',
//                    changeMonth: true,
//                    changeYear: true,
//                }).focus();
//            });
//        });
//        $(function (){
//             $("[id$=txtDate]").datepicker({
//                showOn: 'button',
//                buttonImageOnly: true,
//                buttonImage: 'http://jqueryui.com/demos/datepicker/images/calendar.gif'
//            });
//        });
//        $(function () {
//            $(".datePicker").datepicker({
//                showOn: 'both',
//                dateFormat: 'dd MM yy',
//                changeMonth: true,
//                changeYear: true,
//                yearRange: 'c-1:c+1', 
//                beforeShowDay: noWeekendsOrHolidays });
//        });

//        $(function () {
//            $('#startDate').datepicker({
//                changeMonth: true,
//                changeYear: true,
//                showButtonPanel: false,
//                dateFormat: 'MM yy',
//                onClose: function (dateText, inst) {
//                    var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
//                    var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
//                    $(this).datepicker('setDate', new Date(year, month, 1));
//                }
//            });
//        });


        function check_invalid() {
            var username = $('#TaiKhoan_MaTaiKhoan').val();
            $.ajax({
                url: '<%: Url.Action("CheckValid")%>',
                data: { 'username': username },
                type: "post",
                cache: false,
                success: function (msg) {
                    if (msg == "False") {
                        $('#checkpoint').prop('checked', false);
                        alert("Mã Loại Tài Khoản Không Được Trống");
                    }
                    else if (msg == "True")
                        $('#checkpoint').prop('checked', true);
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    alert("fail");
                }
            });
        }
    </script>

    <style type="text/css">
        .ui-datepicker-calendar {
            display: none;
        }
                
        
    </style>
</asp:Content>

<%--input, textarea, .uneditable-input {
          width:410px !important;
        }--%>